<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box{
            width: 300px;
            height: 200px;
            padding: 10px;
            border:10px dashed red;
            background: url('./test.png');
            color:#fff;
            background-origin: border-box;/*背景图片从什么区域显示 默认是padding-box从内边距开始*/
            /* background-origin: padding-box; 从内边距开始 */
            /* background-origin: content-box; 从内容距开始*/
            background-clip: border-box; /*设置背景在什么区域显示 */
            background-size: cover; /* cover和contain cover铺满但不确定背景图显示完全,contain等比缩放*/
        }
    </style>
</head>
<body>
    <div class='box'>
        我是文字
    </div>
</body>
</html>